home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tpkbd10.zip / KEYBOARD.INT < prev    next >
Text File  |  1991-07-08  |  5KB  |  81 lines

  1. interface
  2.  
  3. {$DEFINE NOCRT}
  4.  
  5. { Remove the above line if you are using the CRT unit and do not want the
  6.   last four routines defined in the interface section to interfere with the
  7.   routines normally defined in the CRT unit. }
  8.  
  9. const
  10.  alt=132; { Alt + letter will return the character 132 above the letter }
  11.  home=#128;      uparrow=#129;       pgup=#130; { numeric }
  12.  leftarrow=#131;               rightarrow=#132; { keypad }
  13.  end_=#133;     downarrow=#134;      pgdn=#135; { keys }
  14.  ins=#136; del=#137;
  15.  F1=#138; F2=#139; F3=#140; F4=#141; F5=#142;
  16.  F6=#143; F7=#144; F8=#145; F9=#146; F10=#147;
  17.  shiftF1=#148; shiftF2=#149; shiftF3=#150; shiftF4=#151; shiftF5=#152;
  18.  shiftF6=#153; shiftF7=#154; shiftF8=#155; shiftF9=#156; shiftF10=#157;
  19.  cntlF1=#158; cntlF2=#159; cntlF3=#160; cntlF4=#161; cntlF5=#162;
  20.  cntlF6=#163; cntlF7=#164; cntlF8=#165; cntlF9=#166; cntlF10=#167;
  21.  altF1=#168; altF2=#169; altF3=#170; altF4=#171; altF5=#172;
  22.  altF6=#173; altF7=#174; altF8=#175; altF9=#176; altF10=#177;
  23.    { Regular, shifted, control, and alternate sets of function keys }
  24.  cntlhome=#183; cntlpgup=#178;
  25.  cntlleftarrow=#179; cntlrightarrow=#180;
  26.  cntlend=#181; cntlpgdn=#182; { Control + keypad keys }
  27.  alt1=#184; alt2=#185; alt3=#186; alt4=#187; alt5=#188;
  28.  alt6=#189; alt7=#190; alt8=#191; alt9=#192; alt0=#193;
  29.    { Alt + numbers from top row of keyboard }
  30.  altminus=#194; altequal=#195; { Alt + "-" or "=" from middle of keyboard }
  31.  reversetab=#196; { Shift + tab key }
  32.  on=true;    { Boolean constans for GetCapslock, GetNumLock, }
  33.  off=false;  { GetScrollLock, SetCapsLock, SetNumLock, and SetScrollLock }
  34.  nonnumeric:boolean=false; { Disallow numbers on numeric keypad }
  35.  
  36. type charset=set of char;
  37.  
  38. var alttyped:boolean; { TRUE if the last key returned by getkey was entered
  39.   on the numeric keypad.  This can be done by holding down the alt key and
  40.   typing the key's ASCII code on the numeric keypad.  Undefined before the
  41.   first call to getkey. }
  42.  
  43. function getkey:char; { enhanced readkey }
  44. procedure readno(var number:word; lobound,hibound:word);
  45. procedure readint(var number:integer; lobound,hibound:integer);
  46. procedure readreal(var number:real; lobound,hibound:real; decimals:byte);
  47.  { Read an unsigned integer, signed integer, or real number between lobound
  48.    and hibound, and with maximum number of decimal places for real number. }
  49. procedure readstr(var s:string; maxlen:byte; charstoexclude:charset);
  50.  { Read a new string into s, starting with an empty string; allow no more
  51.    than maxlen chars; do not allow any characters in the charstoexclude set
  52.    to be entered into the string. }
  53. procedure editstr(var s:string; maxlen:byte; charstoexclude:charset);
  54.  { Edit the string currently in s; same rules as readstr. }
  55. procedure flushbuffer; { Flush all typed-ahead keystrokes from buffer. }
  56. procedure setcapslock(state:boolean);   { Set the caps lock, num lock, }
  57. procedure setnumlock(state:boolean);    { scroll lock, or insert key state }
  58. procedure setscrolllock(state:boolean); { on or off.  State=TRUE means turn }
  59. procedure setinsert(state:boolean);     { on; state=FALSE means turn off. }
  60. function getcapslock:boolean;   { \                                     }
  61. function getnumlock:boolean;    {  \Return current caps lock, num lock, }
  62. function getscrolllock:boolean; {  /scroll lock, or insert state.       }
  63. function getinsert:boolean;     { /                                     }
  64. function screenwidth:byte; { Tell how many characters wide the screen is. }
  65. function leftshiftdown:boolean;  { Returns true if left shift key is down. }
  66. function rightshiftdown:boolean; { Returns true if right shift key is down. }
  67. function shiftdown:boolean; { Returns true if either shift key is down. }
  68. function controldown:boolean; { Returns true if control key is down. }
  69. function altdown:boolean; { Returns true if alt key is down. }
  70. procedure chgcursor(startline,endline:byte);
  71.          { Change the cursor so it starts at startline and ends at endline. }
  72.          { Chgcursor ($20,0) will completely erase the cursor. }
  73. procedure getcursor(var startline,endline:byte);
  74.           { Get the current starting and ending line of the cursor. }
  75. {$IFDEF NOCRT}
  76. function keypressed:boolean; { Returns true if a key is waiting in buffer. }
  77. function wherex:byte; { Returns x-coordinate of cursor. }
  78. function wherey:byte; { Returns y-coordinate of cursor. }
  79. procedure gotoxy(x,y:byte); { Positions cursor at (x,y). }
  80. {$ENDIF}
  81.